function [ADD1,ADD2,ADD3] = matrix_add(N_bit,series)
%蝶形运算矩阵和数据地址误差运算
%   Detailed explanation goes here
%方法1
ADD1 = zeros(3,2^(N_bit-1));
NX = 2^(N_bit-series-1);
% NY = 2^(series);
m=1:2^series;
K=1:2^series;
for B=1:NX
    for L=1:2
        ADD1(L,K) = m-1;
        m=m+2^series;
    end
    K=K+2^series;
end
a = 0:2^(N_bit-1)-1;
WM = 2^(N_bit-1-series);
ADD1(3,:) = mod(a*WM,2^(N_bit-1));
%方法2
ADD2 = zeros(3,2^(N_bit-1));
NX = 2^(N_bit-series-1);
NY = 2^(series);
m=1;
for B=0:NX-1
    for L=0:NY-1
        ADD2(1,m) = B*(2^(series+1))+L;
        ADD2(2,m) = ADD2(1,m)+2^series;
        ADD2(3,m) = mod((m-1)*WM,2^(N_bit-1));
        m=m+1;
    end
end
%方法三
ADD3 = zeros(3,2^(N_bit-1));
for J=0:2^series-1
    for K=J:2^(series+1):2^(N_bit)-2
        X=(K+J)/2+1;
        ADD3(1,X) = K;
        ADD3(2,X) = K+2^(series);
        ADD3(3,X) = 2^(N_bit-1-series)*J;
    end
end
end